import java.awt.Color;
import java.awt.geom.Ellipse2D;
import java.util.Vector;

public class Vertex  extends Ellipse2D.Double{
	private static final long serialVersionUID = 7445236245144080815L;
	public static final int VERTEX_WIDTH = 20;
	public static final int VERTEX_HEIGHT = 20;
	private Vector<Edge> m_links = new Vector<Edge>();
	private int m_weight = 0;
	private Color m_color = Color.GRAY;
	private int m_pathLength = Integer.MAX_VALUE;
	private static int m_current_id = 0;
	private int m_id;
	private String m_name = "";
	private Edge m_pathEdge = null;

	public Vertex(double x, double y, String name)
	{
		super(x, y, VERTEX_WIDTH, VERTEX_HEIGHT);
		m_name = name;
		m_id = m_current_id;
		++m_current_id;
	}

	public void setCoords(double x, double y)
	{
		this.x = x;
		this.y = y;
		for (Edge e : m_links)
		{
			e.refreshPos();
		}
	}

	public Color getColor()
	{
			return m_color;
	}

	public void setColor(Color c)
	{
		m_color = c;
	}

	public Vector<Edge> getLinks()
	{
		return m_links;
	}

	public void addLink(Edge link)
	{
		m_links.add(link);
	}



	public void removeLink(Edge link)
	{
		m_links.remove(link);
	}

	public int getWeight()
	{
		return m_weight;
	}

	public void setWeight(int w)
	{
		m_weight = w;
	}

	public void free(){
		for(Edge e: m_links){
			e.free();
		}
	}
	
	public int getPathLength() {
		return m_pathLength;
	}

	public void setPathLength(int m_pathLength) {
		this.m_pathLength = m_pathLength;
	}

	public Edge getPathEdge() {
		return m_pathEdge;
	}

	public void setPathEdge(Edge m_pathEdge) {
		this.m_pathEdge = m_pathEdge;
	}

	public int getID() {
		return m_id;
	}

	public String getName() {
		return m_name;
	}

	public void setName(String m_name) {
		this.m_name = m_name;
	}
}
